package com.athbsd.exer4;

import java.sql.SQLOutput;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * Date:2025/2/24
 * Author：zhouzhou
 * Description:
 */
public class StudentTest {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        List list=new ArrayList();
        System.out.println("请录入学生的信息:");

        while(true){
            System.out.println("1:继续录入,0:结束录入");
            int selection=sc.nextInt();
            if(selection==0){
                break;
            }
            System.out.println("请输入学生的姓名:");
            String name=sc.next();
            System.out.println("请输入学生的年龄:");
            int age=sc.nextInt();
                Student student=new Student(name,age);
                list.add(student);
        }
        System.out.println("遍历学生的信息.");
        for(Object o:list){
            Student student=(Student)o;
             System.out.println(student.toString());
        }
    }
}
